package com.gao.v_priorityblockingqueue;

import java.util.concurrent.PriorityBlockingQueue;

/**
 * @author gao
 * @time 2021/04/20 22:29:58
 */
public class App {
    public static void main(String[] args) throws Exception {
        PriorityBlockingQueue<Person> queue = new PriorityBlockingQueue<>();

        Person p = new Person(3, "andy");
        Person p2 = new Person(2, "eason");
        Person p3 = new Person(1, "G.E.M");
        Person p4 = new Person(4, "angela chang");

        queue.add(p);
        queue.add(p2);
        queue.add(p3);
        queue.add(p4);

        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());

    }
}
